using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace ERPBackend.Models
{
    public class EBOMItem : BaseModel
    {
        [Required]
        public int BomId { get; set; }

        [ForeignKey("BomId")]
        public EBOM? EBOM { get; set; }

        [Required]
        public int MaterialId { get; set; }

        [ForeignKey("MaterialId")]
        public Material? Material { get; set; }

        [StringLength(255)]
        public string? MaterialName { get; set; }

        [StringLength(255)]
        public string? Specification { get; set; }

        [StringLength(50)]
        public string? Unit { get; set; }

        [Required]
        [Column(TypeName = "decimal(18, 4)")]
        public decimal Quantity { get; set; } = 0;

        [Column(TypeName = "decimal(18, 4)")]
        public decimal ScrapRate { get; set; } = 0;

        [Column(TypeName = "decimal(18, 4)")]
        public decimal TotalQuantity { get; set; } = 0;

        public int Position { get; set; } = 0;

        public string? Remark { get; set; }
    }
}